// import $http from '../utils/axios_test'
import axios from '../utils/axios.js'

// interface login {
//     username: string,
//     password: string
// }

// export const loginAddress = (data: login) => {
//     axios({ method: 'post', url: "http://localhost:8080/pee/login", data }).then(
//         resopnse => {
//             console.log(resopnse.data);
//             localStorage.setItem('Cusertoken', `${'Bearer'} ${resopnse.data.data}`)
//         },
//         error => {
//             return Promise.reject(error)
//         }
//     )
// }

interface data {
    sname: string,
    phone: string,
    province: string,
    city: string,
    town: string,
    detailaddress: string,
    isdefault: number
}
export const getAddress = () => axios({ method: 'get', url: '/foo/api/v1/adrs' })
export const alertAddress = (data: data, ID: any) => axios({ method: 'put', url: `/foo/api/v1/adrs/${ID}`, data })
export const addAddress = (data: data) => axios({ method: 'post', url: '/foo/api/v1/adrs', data })
export const deleteAddress = (data: data, ID: any) => axios({ method: "delete", url: `/foo/api/v1/adrs/${ID}`, data })